package com.datacow.modules.datamanagement.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.datacow.modules.datamanagement.dao.DatacowProductHuntEnDao;
import com.datacow.modules.datamanagement.entity.DatacowProductHuntEnEntity;
import com.datacow.modules.datamanagement.service.DatacowProductHuntEnService;
import com.datacow.util.baidutranslationapi.TransApi;
import org.springframework.stereotype.Service;

import java.util.Map;

import com.datacow.common.utils.PageUtils;
import com.datacow.common.utils.Query;


/**
* @Description:
* @Author: 李德森
* @Date: 2021/1/21
*/
@Service("datacowProductHuntEnService")
public class DatacowProductHuntEnServiceImpl extends ServiceImpl<DatacowProductHuntEnDao, DatacowProductHuntEnEntity> implements DatacowProductHuntEnService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<DatacowProductHuntEnEntity> page = this.page(
                new Query<DatacowProductHuntEnEntity>().getPage(params),
                new QueryWrapper<DatacowProductHuntEnEntity>()
        );

        return new PageUtils(page);
    }

    /**
     * 翻译 英文到中文
     *
     * @param translationString
     */
    @Override
    public String translationEnCN(String translationString) throws Exception {
        /**
         * 翻译 英文到中文
         */
        String transResult = TransApi.getTransResult(translationString, "en", "zh");
        return transResult;
    }
}

